<script type="text/javascript">
function makeList(){
	console.log(this);
    if($('#datepicker').val() != '' && $('#doctors').val() != ' ') {
        $.get(basePath+'/appointment/ajaxGetDoctorDayApps/id/'+
                $('#doctors').val()+
                '/date/'+
                $('#datepicker').val(),
            function(data){
                $('#apps').html('');
                $.each(data, function(key, value) {
                    $('#apps').append("<li>Godzina "+value.hour+": "+value.clientName+"(tel: "+value.clientPhone+", email:"+value.clientEmail+")</li>");
                });
            },
        'json');
    }
	
}

$(document).ready(function() {
	$( "#datepicker" ).datepicker({
	    dateFormat : 'yy-mm-dd'
	});

	$('#datepicker').change(makeList);
	$('#doctors').change(makeList);
});
</script>

<p>Lista wizyt na <input type="text" id="datepicker"> dla <?php echo CHtml::dropDownList('doctor', '', $doctors, array('id' => 'doctors')); ?></p>

<ul id="apps"></ul>